import numpy as np
import matplotlib.pyplot as plt


plt.subplot(2, 2, 1)
x3 = np.linspace(-2, 2, 100000) 
plt.xlim(-2.0, 2.0)  # x轴坐标轴 
plt.ylim(-1, 2) # y轴坐标轴 
plt.yticks(np.linspace(-1, 2.0, 7))
plt.plot(x3, ((x3 ** 2 - 1) / (x3 - 1)), label = "removable discontinuity")
plt.legend(loc='center')
plt.annotate("point", (1, 2.0), arrowprops = dict(facecolor = 'red', shrink = 0.05))

plt.subplot(2, 2, 2)
plt.xlim(-2.0, 2.0)
plt.ylim(0, 2)
plt.plot(x3, abs(x3), label = "jump discontinuity")
plt.legend(loc='best')
plt.annotate("point", (0, 0), arrowprops = dict(facecolor = 'red', shrink = 0.05))

plt.subplot(2, 2, 3)
plt.xlim(-20, 20)
plt.ylim(-1.0, 1)
plt.plot(np.linspace(-20, 20, 1000), np.tan(np.linspace(-20, 20, 1000)), 
         label = "infinite discontinuity")
plt.legend(loc='best')

plt.subplot(2, 2, 4)
plt.xlim(-0.5, 0.5)
plt.ylim(-1.0, 1)
plt.plot(x3, np.sin(1 / x3), label = "Discontinuous point of oscillation")
plt.legend(loc='best')

plt.show()
